The invention relates to the field of client/server (also known as xe2x80x9cdistributedxe2x80x9d) computing, where one computing device (xe2x80x9cthe clientxe2x80x9d) requests another computing device (xe2x80x9cthe serverxe2x80x9d) to perform part of the client""s work. The client and server can also be both located on the same physical computing device.
Client/server computing has become more and more important over the past few years in the information technology world. This type of distributed computing allows one machine to delegate some of its work to another machine that might be, for example, better suited to perform that work. For example, the server could be a high-powered computer running a database program managing the storage of a vast amount of data, while the client is simply a desktop personal computer (PC) which requests information from the database to use in one of its local programs.
The benefits of client/server computing have been even further enhanced by the use of a well-known computer programming technology called object-oriented programming (OOP), which allows the client and server to be located on different (heterogeneous) xe2x80x9cplatformsxe2x80x9d. A platform is a combination of the specific hardware/software/operating system/communication protocol which a machine uses to do its work. OOP allows the client application program and server application program to operate on their own platforms without worrying how the client application""s work requests will be communicated and accepted by the server application. Likewise, the server application does not have to worry about how the OOP system will receive, translate and send the server application""s processing results back to the requesting client application.
Details of how OOP techniques have been integrated with heterogeneous client/server systems are explained in U.S. Pat. No. 5,440,744 and European Patent Published Application No. EP 0 677,943 A2. These latter two publications are hereby incorporated by reference. However, an example of the basic architecture will be given below for contextual understanding of the invention""s environment.
As shown in FIG. 1, the client computer 10 (which could, for example, be a personal computer having the IBM OS/2 operating system installed thereon) has an application program 40 running on its operating system (xe2x80x9cIBMxe2x80x9d and xe2x80x9cOS/2xe2x80x9d are trademarks of the International Business Machines corporation). The application program 40 will periodically require work to be performed on the server computer 20 and/or data to be returned from the server 20 for subsequent use by the application program 40. The server computer 20 can be, for example, a high-powered mainframe computer running on IBM""s MVS operating system (xe2x80x9cMVSxe2x80x9d is also a trademark of the IBM corp.). For the purposes of the present invention it is irrelevant whether the requests for communications services to be carried out by the server are instigated by user interaction with the first application program 40, or whether the application program 40 operates independently of user interaction and makes the requests automatically during the running of the program.
When the client computer 10 wishes to make a request for the server computer 20""s services, the first application program 40 informs the first logic means 50 of the service required. It may for example do this by sending the first logic means the name of a remote procedure along with a list of input and output parameters. The first logic means 50 then handles the task of establishing the necessary communications with the second computer 20 with reference to definitions of the available communications services stored in the storage device 60. All the possible services are defined as a cohesive framework of object classes 70, these classes being derived from a single object class. Defining the services in this way gives rise to a great number of advantages in terms of performance and reusability.
To establish the necessary communication with the server 20, the first logic means 50 determines which object class in the framework needs to be used, and then creates an instance of that object at the server, a message being sent to that object so as to cause that object to invoke one of its methods. This gives rise to the establishment of the connection with the server computer 20 via the connection means 80, and the subsequent sending of a request to the second logic means 90.
The second logic means 90 then passes the request on to the second application program 100 (hereafter called the service application) running on the server computer 20 so that the service application 100 can perform the specific task required by that request, such as running a data retrieval procedure. Once this task has been completed the service application may need to send results back to the first computer 10. The server application 100 interacts with the second logic means 90 during the performance of the requested tasks and when results are to be sent back to the first computer 10. The second logic means 90 establishes instances of objects, and invokes appropriate methods of those objects, as and when required by the server application 100, the object instances being created from the cohesive framework of object classes stored in the storage device 110.
Using the above technique, the client application program 40 is not exposed to the communications architecture. Further the service application 100 is invoked through the standard mechanism for its environment; it does not know that it is being invoked remotely.
The Object Management Group (OMG) is an international consortium of organizations involved in various aspects of client/server computing on heterogeneous platforms with distributed objects as is shown in FIG. 1. The OMG has set forth published standards by which client computers (e.g. 10) communicate (in OOP form) with server machines (e.g. 20). As part of these standards, an Object Request Broker (called CORBA-the Common Object Request Broker Architecture) has been defined, which provides the object-oriented bridge between the client and the server machines. The ORB decouples the client and server applications from the object oriented implementation details, performing at least part of the work of the first and second logic means 50 and 90 as well as the connection means 80.
As part of the CORBA software structure, the OMG has set forth standards related to xe2x80x9ctransactionsxe2x80x9d and these standards are known as the OTS or Object Transaction Service. See, e.g., CORBA Object Transaction Service Specification 1.0, OMG Document 94.8.4. Computer implemented transaction processing systems are used for critical business tasks in a number of industries. A transaction defines a single unit of work that must either be fully completed or fully purged without action. For example, in the case of a bank automated teller machine from which a customer seeks to withdraw money, the actions of issuing the money, reducing the balance of money on hand in the machine and reducing the customer""s bank balance must all occur or none of them must occur. Failure of one of the subordinate actions would lead to inconsistency between the records and the actual occurrences.
Distributed transaction processing involves a transaction that affects resources at more than one physical or logical location. In the above example, a transaction affects resources managed at the local automated teller device as well as bank balances managed by a bank""s main computer. Such transactions involve one particular client computer (e.g, 10) communicating with one particular server computer (e.g., 20) over a series of client requests which are processed by the server. The OMG""s OTS is responsible for coordinating these distributed transactions.
An application running on a client process begins a transaction which may involve calling a plurality of different servers, each of which will initiate a server process to make changes to its local data according to the instructions contained in the transaction. The transaction finishes by either committing the transaction (and thus all servers finalize the changes to their local data) or aborting the transaction (and thus all servers xe2x80x9crollbackxe2x80x9d or ignore the changes to their local data made during the transaction). To communicate with the servers during the transaction (e.g., instructing them to either commit or abort their part in the transaction) one of the processes involved must maintain state data for the transaction. According to the OTS standard, this involves the process setting up a series of objects, one of which is a coordinator object which coordinates the transaction with respect to the various servers.
The main purpose of this coordinator object is to keep track of which server objects are involved in the transaction, so that when the transaction is finished, each server object involved in the transaction can be told to commit the changes made locally to the local database associated with that server object, in a single unified effort. This ensures that no server object makes a data change final without the other server objects which are also involved in the same transaction doing so. Thus, each server object which is to join a transaction must first register with the coordinator object so that the coordinator object will know of the server object""s existence, its wish to join the transaction, and where to find the server object (e.g., which server machine the server object resides on) when it comes time to complete the transaction (where the coordinator object instructs all server objects to make the changes to their respective local data final).
A server object responsible for updating data (referred to hereinbelow as a resource object) gets involved in a transaction when another server object (or the original client object which started the transaction) sends a request to the resource object for the resource object to do some work. This latter request carries some information, called the transaction context, to inform the resource object that the request is part of a transaction. With CORBA version 2, the transaction context is built by the local CosTransactions::Coordinator object get_txcontext method. Once a resource object finds out that it is to be involved in a transaction, it then makes a registration request with the coordinator object.
When the resource object is located in a different operating system process from the coordinator object, it has been found to be useful to use a subordinate coordinator object (222 in FIG. 2) located in the same operating system process as the resource object (223 or 224). The main coordinator object is then called the xe2x80x9csuperior coordinator objectxe2x80x9d 211. During registration of a resource object 223 to the transaction, the subordinate coordinator 222 is set up locally inside the server machine 22 which houses the resource object 223 and the resource object 223 communicates directly with this subordinate coordinator object 222 when it makes a registration request. (It should be noted that while the term xe2x80x9cserver machinexe2x80x9d is used here, the term xe2x80x9cserver processxe2x80x9d could also be used, to thus indicate that the distributed server objects could, in fact, be located on the same server machine but on different operating system processes running on the server machine, and hereinafter the term xe2x80x9cserverxe2x80x9d will be used to refer to both terms.) The subordinate coordinator 222, in turn, registers itself with the superior coordinator object 211 (which is located in another process possibly on another server machine as if it were a resource object).
The subordinate coordinator object 222 thus provides a representation of the existence of the transaction within the server housing the resource object. Instead of communicating directly with the superior coordinator object 211, the resource objects 223 and 224 first communicate with their local subordinate coordinator object 222 which in turn communicates with the superior coordinator object. This greatly reduces the number of cross-operating-system-process calls.
Oftentimes, a transaction will involve a number of different processes, each potentially running on a different server machine. For example, in server process 21 (which includes superior coordinator 211) may call three different processes to take part in a distributed transaction, and thus each of such processes would result in the creation of a subordinate coordinator to locally coordinate the transaction in that process. At the end of the transaction, the superior coordinator would use the traditional two-phase commit protocol to make sure that each of the three processes makes its changes final in a unitary xe2x80x9call or nothingxe2x80x9d fashion (i.e., either they all commit their changes or they all roll back their changes). The two phase commit protocol traditionally involves sending a prepare call to each of the three subordinate coordinators and then sending a commit call to each of the three subordinate coordinators, assuming that they have all voted to commit in response to the prepare call. This would, thus, involve the superior coordinator 211 sending six cross-process calls.
A well known optimization of the two phase commit protocol, which is often used to reduce the number of total cross process calls in the two phase commit, is known as the xe2x80x9clast agent optimizationxe2x80x9d (e.g., see Transaction Processing: Processes and Techniques by Gray and Reuter, Morgan Kaufman Publishers, September 1992, Section 12.5.3). To summarize this optimization, if a transaction root coordinator (e.g., superior coordinator 211) has N resources (e.g., representing 3 subordinate coordinators) involved in a transaction it will prepare (i.e., send prepare flows to) Nxe2x88x921 of them. At this point if all the resources vote commit (the usual case) the transaction outcome depends only on the last resource""s prepare vote. We can therefore combine the prepare and commit flows to the last resource, this optimized final flow is catered for in the CORBA CosTransactions specification by the resource::commit_one_phase method. In this discussion, subordinate coordinators, their resources, and other resources can be treated the same way and are generically termed the xe2x80x98agentsxe2x80x99 involved. With the last agent optimization, the message flows are halved between the coordinator and the last agent over the simple case for two phase commit.
In an implementation of the standard CosTransactions service of CORBA""s OTS, a root coordinator of a distributed transaction will typically have a number of agents registered in the transaction. Some may represent local application or database resources, some may represent other subordinate coordinators (xe2x80x98resources) in other processes of the same machine and some may represent agents in remote machines. Any one of these resources is a valid candidate to be prepared last and in the CosTransaction service, (as used in IBM""s Component Broker (CB) software product, for example) there is no differentiation between such classes of resource.
However, the message flows to these three categories of resource are likely to take widely varying times to flow. For example, one of the processes could be connected to the superior coordinator 211""s process via a satellite link, while another of the processes could be located on a server machine that is very close to the superior coordinator 211""s process. The amount of time the commit_one_phase operation (i.e., last agent optimization) will actually save can thus vary widelyxe2x80x94for a local resource this savings will be minimal but for a remote resource on a distant machine the saving in message traffic and commit completion time is much more valuable.
In the context of client/server transaction processing, there has heretofore not been known a way to optimize the selection of the last agent for use in the last agent optimization, and this deficiency in the prior art has been the stimulus which has led the present inventor to the present invention.
According to a first aspect, the present invention provides a first server computing apparatus for use in a client/server transaction processing system, the first apparatus having: means for sending a request to a second server data processing apparatus that is involved in processing a distributed transaction; means for receiving a reply to the request from the second server data processing apparatus, the reply including an indication of the total amount of time that the second server data processing apparatus has taken to process the request and generate the reply; a first means for determining the total amount of time that has elapsed between the sending of the request by the first apparatus and the receipt of the reply by the first apparatus; a second means for determining the total amount of transit time for the request to travel from the first apparatus to the second apparatus and the reply to travel from the second apparatus to the first apparatus, where the second means uses the output of the first means and the indication provided in the reply to determine the total amount of transit time; a means for keeping a record based on the results of the second means over a plurality of server data processing apparatuses that are involved in the transaction; a selection means for selecting one of the apparatuses as a last agent for use in a last agent optimization operation during completion of the distributed transaction, based on the results of the means for keeping.
Preferably, the indication is provided in each reply as part of a transaction propagation context. Further preferably, the indication is provided in each reply in a Common Object Request Broker Object Transaction Service  less than any greater than  field of the transaction propagation context.
According to a second aspect, the invention provides a method of operating a first server computing apparatus for use in a client/server transaction processing system, the method comprising steps of: (a) sending a request to a second server data processing apparatus that is involved in processing a distributed transaction; (b) receiving a reply to the request from the second server data processing apparatus, the reply including an indication of the total amount of time that the second server data processing apparatus has taken to process the request and generate the reply; ĉ determining the total amount of time that has elapsed between the sending of the request by the first apparatus and the receipt of the reply by the first apparatus; (d) determining the total amount of transit time for the request to travel from the first apparatus to the second apparatus and the reply to travel from the second apparatus to the first apparatus, wherein the step (d) uses the output of the step ĉ and the indication provided in the reply to determine the total amount of transit time; (e) keeping a record based on the results of step (d) over a plurality of server data processing apparatuses that are involved in the transaction; (f) selecting one of the apparatuses as a last agent for use in a last agent optimization operation during completion of the distributed transaction, based on the results of step (e). 
According to a third aspect, the invention provides a program storage device readable by a machine, tangibly embodying a program of instructions executable by the machine to perform the method steps of the second aspect.
Thus, the invention enables the calculation of the total time taken by the flow of a request from a first server process to another server process and for the corresponding reply to flow back to the first server process, without including the time taken for the receiving server process to process the request and generate the reply. As resources are registered with the coordinator in the first server process, the coordinator keeps a record of which resource had the longest round trip message delivery time and ensures that if it is in a situation to use the commit_one_phase method (ie it is the root coordinator originally or has received commit_one_hase itself), this method is flowed to a resource where the maximum time will be saved.
The present invention thus ensures the maximum benefit out of the well known concept of last agent optimization. As many modern distributed systems such as those based on CORBA""s OTS are xe2x80x98location transparentxe2x80x99 in the application layers local and remote resources are often treated homogeneously. However, using commit_one_phase to a local resource saves relatively little time in a transaction that also has a remote participant and will thus be making remote message flows as part of completion. This optimization is inexpensive to implement, in terms of CPU loading and message data volume.